<template>
	<view class="user">
		<view class="top">
			<view class="img">
				<image src="../../static/播放记录.png" mode="aspectFill"></image>
			</view>
			<text>历史浏览记录</text>
		</view>
		<view class="contents">
			<view class="row" v-for="item in listArr">
				<newsbox :item="item" @click.native="goinfo(item)"></newsbox>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				listArr:[]
			};
		},
		// 监听页面显示
		onShow() {
			this.getData()
		},
		methods:{
			// 跳转详情页
			goinfo(item) {
				uni.navigateTo({
					url: `/pages/info/info?cid=${item.classid}&id=${item.id}`
				})
			},
			// 读取本地存储
			getData(){
				let hisArr = uni.getStorageSync("historyArr") || []
				this.listArr = hisArr
			}
		}
	}
</script>

<style lang="scss">
	.user {
		.top {
			margin: 30px 0;
			.img {
				margin: 0 auto;
				width: 200rpx;
				height: 200rpx;
				image {
					width: 100%;
					height: 100%;
				}
			}

			text {
				color: #555;
				font-size: 38rpx;
				display: block;
				text-align: center;
			}
		}
	}
	.contents{
		padding:30rpx 20rpx 0;
		.row{
			border-bottom: 1rpx dotted #b4b4b4;
			margin-bottom: 10rpx;
		}
	}
</style>
